<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">
<link href="style/editor.css" rel="stylesheet" type="text/css">
<script>
  var sLangDir=dialogArguments.oUtil.langDir;
  document.write("<scr"+"ipt src='language/"+sLangDir+"/media.js'></scr"+"ipt>");
</script>
<script>writeTitle()</script>
<script>
function GetElement(oElement,sMatchTag)
  {
  while (oElement!=null&&oElement.tagName!=sMatchTag)
    {
    if(oElement.tagName=="BODY")return null;
    oElement=oElement.parentElement;
    }
  return oElement;
  }

function doWindowFocus()
  {
  dialogArguments.oUtil.onSelectionChanged=new Function("realTime()");
  }
function bodyOnLoad()
  {
  window.onfocus=doWindowFocus; 
  dialogArguments.oUtil.onSelectionChanged=new Function("realTime()");

  if(dialogArguments.oUtil.obj.cmdAssetManager!="")btnAsset.style.display="block";

  realTime()
  }
function openAsset()
  {
  inpURL.value=eval(dialogArguments.oUtil.obj.cmdAssetManager); 
  }
function modalDialogShow(url,width,height)
  {
  if(url.indexOf("?")==-1) url=url+"?ffilter=media";//no querystring
  else url=url+"&ffilter=media";

  return window.showModalDialog(url,window,
    "dialogWidth:"+width+"px;dialogHeight:"+height+"px;edge:Raised;center:Yes;help:No;Resizable:Yes;Maximize:Yes");
  }
function realTime()
  {
  if(!dialogArguments.oUtil.obj.checkFocus()){return;}//Focus stuff
  var oEditor=dialogArguments.oUtil.oEditor;
  var oSel=oEditor.document.selection.createRange();
  var sType=oEditor.document.selection.type;

  clearAllProperties()

  if (oSel.parentElement) oEl=GetElement(oSel.parentElement(),"EMBED");
  else oEl=GetElement(oSel.item(0),"EMBED");
  if (oEl)
    {   
    inpURL.value=oEl.src;
    inpWidth.value=oEl.width;
    inpHeight.value=oEl.height;
    if(oEl.autoRewind)chkAutoRewind.checked=true;
    else chkAutoRewind.checked=false;
    if(oEl.showDisplay)chkShowDisplay.checked=true;
    else chkShowDisplay.checked=false;
    if(oEl.showStatusbar)chkShowStatusBar.checked=true;
    else chkShowStatusBar.checked=false;
    if(oEl.showControls)chkShowControls.checked=true;
    else chkShowControls.checked=false;
    if(oEl.autoStart)chkAutoStart.checked=true;
    else chkAutoStart.checked=false;
    
    btnApply.style.display="block";
    btnOk.style.display="block";
    btnInsert.style.display="none";
    }
  else
    {
    btnApply.style.display="none";
    btnOk.style.display="none";
    btnInsert.style.display="block";
    }
  }
function clearAllProperties()
  {
  inpURL.value="";
  inpWidth.value="320";
  inpHeight.value="290";
  chkAutoStart.checked=true;
  chkShowControls.checked=true;
  chkShowStatusBar.checked=false;
  chkShowDisplay.checked=false;
  chkAutoRewind.checked=true;
  }

function insertMedia()
  {
  if(!dialogArguments.oUtil.obj.checkFocus()){return;}//Focus stuff
  var oEditor=dialogArguments.oUtil.oEditor;
  
  dialogArguments.oUtil.obj.saveForUndo();
  
  if(chkAutoStart.checked)sAutoStart="true";
  else sAutoStart="false";
  
  if(chkShowControls.checked)sShowControls="true";
  else sShowControls="false";
  
  if(chkShowStatusBar.checked)sShowStatusBar="true";
  else sShowStatusBar="false";
  
  if(chkShowDisplay.checked)sShowDisplay="true";
  else sShowDisplay="false";
  
  if(chkAutoRewind.checked)sAutoRewind="true";
  else sAutoRewind="false";
  
  /*
  var sHTML = "<object width='320' height='290' "+
    "classid='"+inpCLassID.value+"'>"+ 
    "<param name='Filename' value='"+inpURL.value+"'>"+
    "<param name='AutoStart' value='"+sAutoStart+"'>"+
    "<param name='ShowControls' value='"+sShowControls+"'>"+
    "<param name='ShowStatusBar' value='"+sShowStatusBar+"'>"+
    "<param name='ShowDisplay' value='"+sShowDisplay+"'>"+
    "<param name='AutoRewind' value='"+sAutoRewind+"'>"+
    " <embed "+
    " type='application/x-mplayer2' "+
    " pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/' "+
    " width='"+inpWidth.value+"' "+
    " height='"+inpHeight.value+"' "+
    " src='"+inpURL.value+"' "+
    " filename='"+inpURL.value+"' "+
    " autostart='"+sAutoStart+"' "+
    " showcontrols='"+sShowControls+"' "+
    " showstatusbar='"+sShowStatusBar+"' "+ 
    " showdisplay='"+sShowDisplay+"' "+
    " autorewind='"+sAutoRewind+"'>"+
    " </embed>"+ 
    "</object>"*/
    
  var sHTML = "<embed selThis=\"selThis\" "+
    "type='application/x-mplayer2' "+
    "pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/' "+
    "width='"+inpWidth.value+"' "+
    "height='"+inpHeight.value+"' "+
    "src='"+inpURL.value+"' "+
    "filename='"+inpURL.value+"' "+
    "autostart='"+sAutoStart+"' "+
    "showcontrols='"+sShowControls+"' "+
    "showstatusbar='"+sShowStatusBar+"' "+ 
    "showdisplay='"+sShowDisplay+"' "+
    "autorewind='"+sAutoRewind+"'></embed>"
  
  var obj=dialogArguments.oUtil.obj;
  obj.insertHTML(sHTML);
  
  for(var i=0;i<oEditor.document.all.length;i++)
    {
    if(oEditor.document.all[i].getAttribute("selThis")=="selThis")
      {
      oEditor.document.all[i].removeAttribute("selThis",0);       
      var oSelRange = oEditor.document.body.createControlRange()
      oSelRange.add(oEditor.document.all[i]);
      oSelRange.select();         
      }
    }
  
  realTime();
  
  dialogArguments.realTime(dialogArguments.oUtil.oName);
  dialogArguments.oUtil.obj.selectElement(0);
  }
function updateMedia()
  {
  if(!dialogArguments.oUtil.obj.checkFocus()){return;}//Focus stuff
  var oEditor=dialogArguments.oUtil.oEditor;
  var oSel=oEditor.document.selection.createRange();
  var sType=oEditor.document.selection.type;
  
  dialogArguments.oUtil.obj.saveForUndo();

  if (oSel.parentElement) oEl=GetElement(oSel.parentElement(),"EMBED");
  else oEl=GetElement(oSel.item(0),"EMBED");
  if (oEl)
    {
    oEl.src=inpURL.value;
    oEl.width=inpWidth.value;
    oEl.height=inpHeight.value;
    
    if(chkAutoRewind.checked)oEl.autoRewind=true;
    else oEl.autoRewind=false;
    if(chkShowDisplay.checked)oEl.showDisplay=true;
    else oEl.showDisplay=false;
    if(chkShowStatusBar.checked)oEl.showStatusbar=true;
    else oEl.showStatusbar=false;
    if(chkShowControls.checked)oEl.showControls =true;
    else oEl.showControls =false;
    if(chkAutoStart.checked)oEl.autoStart=true;
    else oEl.autoStart=false;
    }
  realTime()
  }
</script>
</head>
<body onload="loadTxt();bodyOnLoad()" style="overflow:hidden;">

<table width=100% height=100% align=center cellpadding=0 cellspacing=0>
<tr>
<td valign=top style="padding:5;height:100%">

  <table cellpadding=2 cellspacing=0  style="width:100%">
  <tr>
    <td nowrap><span id="txtLang" name="txtLang">Source</span>:&nbsp;&nbsp;</td>
    <td colspan="4" style="width:100%">
      <table cellpadding="0" cellspacing="0" style="width:100%">
      <tr>
      <td style="width:100%"><input type="text" name=inpURL size=45 value="" style="width:100%" class="inpTxt"></td>
      <td><input type="button" value="" onclick="openAsset()" id="btnAsset" name="btnAsset" style="display:none;background:url('openAsset.gif');width:23px;height:18px;border:#a5acb2 1px solid;margin-left:1px;"></td>
      </tr>
      </table>    
    </td>
  </tr>
  <tr>
    <td nowrap><span id="txtLang" name="txtLang">Width</span>:</td>
    <td colspan="4"><input type="text" name="inpWidth" value=320 size=4 class="inpTxt"></td>
  </tr>
  <tr>
    <td nowrap><span id="txtLang" name="txtLang">Height</span>:</td>
    <td colspan="4"><input type="text" name="inpHeight" value=290 size=4 class="inpTxt"></td>
  </tr> 
  <!--
  <tr>
    <td colspan="5"><hr>
    </td>
  </tr>
  <tr>
    <td><span id="txtLang" name="txtLang">Class ID</span>:&nbsp;&nbsp;</td>
    <td colspan="4">
      <select name="inpCLassID">
      <option value="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" selected>CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95</option>
      <option value="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6">CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6</option>
      </select>
    </td>
  </tr>
  <tr>
    <td colspan="5" height="7px">
    </td>
  </tr>-->
  <tr>
    <td nowrap><span id="txtLang" name="txtLang">Auto Start</span>:</td>
    <td>
    <input type="checkbox" name="chkAutoStart" class="inpChk" checked>
    </td>
    <td colspan="3" rowspan="5">
      &nbsp;
    </td>
  </tr> 
  <tr>
    <td nowrap><span id="txtLang" name="txtLang">Show Controls</span>:</td>
    <td nowrap>
    <input type="checkbox" name="chkShowControls" class="inpChk" checked>
    </td>
  </tr> 
  <tr>
    <td nowrap><span id="txtLang" name="txtLang">Show Status Bar</span>:</td>
    <td nowrap>
    <input type="checkbox" name="chkShowStatusBar" class="inpChk">
    </td>
  </tr>
  <tr>
    <td nowrap><span id="txtLang" name="txtLang">Show Display</span>:</td>
    <td nowrap>
    <input type="checkbox" name="chkShowDisplay" class="inpChk">
    </td>
  </tr>
  <tr>
    <td nowrap><span id="txtLang" name="txtLang">Auto Rewind</span>:</td>
    <td nowrap>
    <input type="checkbox" name="chkAutoRewind" class="inpChk" checked>
    </td>
  </tr>
  </table>
  
</td>
</tr>
<tr>
<td class="dialogFooter" style="padding:6;" align="right">
  <table cellpadding=1 cellspacing=0>
  <tr>
  <td>
  <input type="button" name=btnCancel id=btnCancel value="cancel" onclick="self.close()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
  </td>
  <td>
  <input type="button" name=btnInsert id=btnInsert value="insert" onclick="insertMedia();self.close()" style="display:block" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
  </td>
  <td>  
  <input type="button" name=btnApply id=btnApply value="apply" onclick="updateMedia()" style="display:none" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
  </td>
  <td>  
  <input type="button" name=btnOk id=btnOk value=" ok " onclick="updateMedia();self.close()" style="display:none;" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'"> 
  </td>
  </tr>
  </table>
</td>
</tr>
</table>

</body>
</html>